package com.pdsu.graduation_design.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.pdsu.graduation_design.R;

import java.util.List;

public class MyBuysGridViewAdapter extends BaseAdapter {

    public MyBuysGridViewAdapter(Context context) {
        this.context = context;
    }

    /**
     * 参数
     * Context List<>
     * @return
     */


    private Context context;

    private List<String> names;

    private ImageView imageView;
    private TextView title;

    private int[] images={R.drawable.my_qianbao,R.drawable.my_huoche2,R.drawable.my_daishouhuo,R.drawable.my_daipingjia,R.drawable.my_tuikuan2};
    private String[] titles={"全部订单","代发货","待收货","待评价","退款"};



    @Override
    public int getCount() {
        return images.length;
    }

    @Override
    public Object getItem(int position) {
        return images[position];
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {

        View view=View.inflate(context, R.layout.my_gridview_item,null);

        imageView=view.findViewById(R.id.my_gridview_image);
        title=view.findViewById(R.id.my_gridview_title);

        imageView.setImageResource(images[position]);
        title.setText(titles[position]);


        return view;
    }
}
